package com.zzj.tch;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TchMd5
{
    public static final String KEY_FONT="I71C1G6AJnCHLFi4sbI5dEr6SL0nBwbQCHJJQx9gpXc39iIqsVfNNw";

    public static  String  getResult(String inputStr)
    {
        System.out.println("=======加密前的数据:"+inputStr);
        BigInteger bigInteger=null;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            inputStr=KEY_FONT+inputStr;
            byte[] inputData = inputStr.getBytes();
            md.update(inputData);
            bigInteger = new BigInteger(md.digest());
        } catch (Exception e) {e.printStackTrace();}
        return bigInteger.toString(16);
    }

    public static void main(String args[])
    {
        try {
            SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyyMMdd");
            String inputStr = simpleDateFormat.format(new Date());
            String sign=getResult(inputStr);
            System.out.println(sign);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
